﻿create function [Guid].[TryParse] ( @p_String varchar(36) )
returns uniqueidentifier as
begin
  
  if @p_String like Replicate( '[0-9a-fA-F]',  8 ) + '-' + Replicate( Replicate( '[0-9a-fA-F]',  4 ) + '-', 3 ) + Replicate( '[0-9a-fA-F]', 12 )
  begin
    return Convert( uniqueidentifier, @p_String );
  end

  return null;
  
end